from PyQt4.QtGui import QApplication
import time, sys
from wedewoba.browser import PageBrowser

class App(QApplication):

    def __init__(self, *args):
        if not len(args):
            args = (sys.argv[0],)
        super(App, self).__init__(list(args))
        self.setApplicationName(str(self.__class__.__name__)+str(time.time())) 

    def run(self):
        sys.exit(self.exec_())


class BrowserApp(App):

    def __init__(self, *args, **kwargs):
        super(BrowserApp, self).__init__(*args)
        self.browser = PageBrowser(*args, **kwargs)

    def run(self, url=None):
        if url != None:
            self.browser.loadPage(url)
        super(BrowserApp, self).run()
        
